﻿using System;
using System.IO;

namespace SolidPrinciples.SingleResponsibility.Novelist
{
	/// <summary>
	///     SRP violations:
	///     1. Takes care about novelist input source and analysis the input
	///     2. Performs persistance to file
	/// </summary>
	public class TypeWriter
	{
		public void StartNovel(string novelFilePath)
		{
			using (StreamWriter novelFile = File.CreateText(novelFilePath))
			{
				ConsoleKeyInfo pressedKey = Console.ReadKey();
				if (pressedKey.Key != ConsoleKey.Escape)
				{
					novelFile.Write(pressedKey.KeyChar);
				}
			}
		}
	}
}